<template>
	<view class="content">
		<!-- <navbar title='店铺主页' backgroundColor="#52443B" backColor="#fff">
		</navbar> -->
		<image class="img_bj" src="@/pages_client/static/mine/img_bj.png" mode="" />
		<view class="content">
			<view class="head" :style="{paddingTop: titleTop + 'px'}">
				<u-icon @click="getback" name="arrow-left" color="#222222" size="45"></u-icon>
				<view class="shopview">
					<image class="img_tx" :src="shopinfo.logo" mode="" />
					<view class="shopright">
						<text class="sname">{{shopinfo.name}}</text>
						<view class="hui">
							<view class="huiitem">{{ shopinfo.level }}</view>
						</view>
					</view>
				</view>
				<view class="shopnav">
					<view class="mshop" @click="getdianpu">
						<image class="img_ds_cc" src="@/pages_client/static/mine/img_ds_cc.png" />
						<view class="shopright">
							<view class="shopone">
								<text class="dianname">商品管理</text>
								<image class="ricons" src="@/pages_client/static/mine/icon_ck.png" />
							</view>
							<text class="gname">共{{info.goods_nums||0}}件</text>
						</view>
					</view>
					<view class="mshop ml" @click="getxuanpin">
						<image class="img_ds_cc" src="@/pages_client/static/mine/img_ds_xp.png" />
						<view class="shopright">
							<view class="shopone">
								<text class="dianname">选品广场</text>
								<image class="ricons" src="@/pages_client/static/mine/icon_ck.png" />
							</view>
							<text class="gname">东方蓉妍产品</text>
						</view>
					</view>
				</view>
			</view>
			<view class="ttwo" style="padding: 30rpx 0;">
				<!-- <text class="biaoti">我的钱包</text> -->
				<view class="tiview">
					<text class="biaoti">我的钱包</text>
					<view class="quanbu" @click="getqianbao">
						<text class="quan">详情</text>
						<image class="icon_right" src="@/pages_client/static/img/comm_icon_next.png" mode="" />
					</view>
				</view>
				<view class="tworow">
					<view class="yeitem">
						<text class="yenum">{{info.money||0}}</text>
						<text class="yename">账户余额</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{info.withdraw||0}}</text>
						<text class="yename">提现中</text>
					</view>
				</view>
			</view>
			<view class="ttwo" style="padding: 30rpx 0;">
				<view class="tiview">
					<text class="biaoti">电商订单</text>
					<view class="quanbu" @click="getdianorder(1)">
						<text class="quan">详情</text>
						<image class="icon_right" src="@/pages_client/static/img/comm_icon_next.png" mode="" />
					</view>
				</view>
				<view class="tworow">
					<view class="yeitem">
						<text class="yenum">{{info.order_nums_today||0}}</text>
						<text class="yename">今日成交订单</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{info.order_nums_nosend||0}}</text>
						<text class="yename">待发货</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{info.order_nums_money||0}}</text>
						<text class="yename">预估金额（元）</text>
					</view>
				</view>
			</view>
			<view class="ttwo" style="padding: 30rpx 0;">
				<view class="tiview">
					<text class="biaoti">团购订单</text>
					<view class="quanbu" @click="getdianorder(2)">
						<text class="quan">详情</text>
						<image class="icon_right" src="@/pages_client/static/img/comm_icon_next.png" mode="" />
					</view>
				</view>
				<view class="tworow">
					<view class="yeitem">
						<text class="yenum">{{info.tuan_nums_yes||0}}</text>
						<text class="yename">今日售出订单</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{info.order_nums_money||0}}</text>
						<text class="yename">今日核销订单</text>
					</view>
					<view class="yeitem">
						<text class="yenum">{{info.tuan_nums_no||0}}</text>
						<text class="yename">待核销订单</text>
					</view>
				</view>
			</view>

			<view class="mthree">
			    <text class="qita">服务工具</text>
				<view class="qitaview">
					
					<view class="qitem" v-for="(item,index) in mlist" :key="index" @click="mClick(item)">
						<image class="micon" :src="item.img" />
						<text>{{item.name}}</text>
					</view>
					<view class="qitem">
						<button  open-type="contact" class="btn">
						</button>
						<view class="mvone">
							<image class="micon" src="@/pages_client/static/mine/icon_gj_lxkf.png" />
							<text>联系客服</text>
						</view>
						
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleTop:0,
				mlist:[
					// {id:1,name:'更换账号',img:'/static/mine/icon_zh.png'},
					{id:1,name:'团购管理',img:'/pages_client/static/mine/icon_gj_tjtg.png'},
					{id:2,name:'顾客管理',img:'/pages_client/static/mine/icon_gj_glgk.png'},
					{id:3,name:'核销管理',img:'/pages_client/static/mine/icon_gj_hxgl.png'},
					{id:4,name:'商学院',img:'/pages_client/static/mine/icon_gj_sxy.png'},
					
				],
				shop_id:'1',
				info:{},
				shopinfo:{},
				latitude:'',
				longitude:'',
				user:{}
			}
		},
		onLoad(option) {
			// if(option.shop_id){
			// 	this.shop_id = option.shop_id
			// }
		
			
		},
		mounted() {
			// #ifdef MP-WEIXIN
			let that = this;
			// 获取胶囊按钮位置信息
			const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			const { top, height } = menuButtonInfo;
			const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;

			// 计算标题需要偏移的位置
			const titleTop = top + (height - statusBarHeight) / 2;
			this.titleTop = titleTop;//设置标题顶部距离
			this.statusBarHeight = statusBarHeight;//设置状态栏高度
			// #endif
			// #ifdef H5
			this.titleTop = 20;//设置标题顶部距离
			// #endif
		},
		onShow() {
			this.getuser()
		},
		methods: {
			async getuser(){
				let res = await this.$u.api.getData({
				});
				this.user = res.data
				this.shop_id = this.user.shop_id
				this.getshuju();
				this.getinfo();
			},
			async getinfo(){
				let res = await this.$u.api.getShopInfo({
					shop_id:this.shop_id,
					lat:this.latitude,
					lng:this.longitude,
				});
				this.shopinfo = res
			},
			async getshuju(){
				
				let res = await this.$u.api.getShopData({
					shop_id:this.shop_id
				});
				this.info = res
			},
			getdianpu(){
				this.navrouter("/pages_client/mine/StoreManage?shop_id="+this.shop_id);
			},
			getqianbao(){
				this.navrouter("/pages_client/twoPage/M-walletShop?shop_id="+this.shop_id);
			},
			getback(){
				uni.navigateBack({ delta: 1 })
			},
			mClick(item){
				let id = item.id
				if(id == 2){
					//顾客管理
					this.navrouter("/pages_client/mine/MyGuke?shop_id="+this.shop_id);
				}else if(id == 4){
					//商学院
					this.navrouter("/pages_client/mine/BusinessList");
				}else if(id == 1){
					//团购管理
					this.navrouter("/pages_client/mine/ShopManage?shop_id="+this.shop_id);
				}else if(id == 3){
					//核销管理
					this.navrouter("/pages_client/twoPage/MyHexiao?shop_id="+this.shop_id);
				}
			},
			getxuanpin(){
				this.navrouter("/pages_client/mine/XPManage?shop_id="+this.shop_id);
			},
			getdianorder(e){
				if(e == 1){
					//电商订单
					this.navrouter("/pages_client/mine/DSOrder?shop_id="+this.shop_id+'&type=1');
				}else if(e == 2){
					this.navrouter("/pages_client/mine/DSOrder?shop_id="+this.shop_id+'&type=2');
					//s团购订单
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #f9f9f9;
	}
	.head{
		padding: 30rpx;
		display: flex;
		flex-direction: column;
		.shopview{
			margin:40rpx 20rpx 20rpx;
			display: flex;
			flex-direction: row;
			.img_tx{
				width: 117rpx;
				height: 117rpx;
				margin-right: 22rpx;
				border-radius: 50%;
			}
			.shopright{
				width: 80%;
				display: flex;
				flex-direction: column;
				padding: 10rpx 0;
				.sname{
					font-weight: bold;
					font-size: 32rpx;
					color: #1A1A1A;
				}
				.hui{
					display: flex;
					flex-direction: row;
					margin-top: 20rpx;
					.huiitem{
						padding: 4rpx 20rpx;
						background: linear-gradient(-90deg, #272727, #4D4D4D);
						border-radius: 10rpx;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFFFFF;
					}
				}
			}
		}
		.shopnav{
			display: flex;
			flex-direction: row;
			margin-top: 20rpx;
			.navs{
				width: 48%;
				padding: 20rpx;
				background-color: #fff;
				border-radius: 20rpx;
				display: flex;
				flex-direction: row;
			}
			.mshop{
				width: 48%;
				display: flex;
				padding: 20rpx;
				background-color: #fff;
				border-radius: 20rpx;
				display: flex;
				flex-direction: row;
				.img_ds_cc{
					width: 90rpx;
					margin-right: 13rpx;
					height: 90rpx;
				}
				.shopright{
					display: flex;
					flex-direction: column;
					.shopone{
						display: flex;
						flex-direction: row;
						align-items: center;
						.dianname{
							font-weight: bold;
							font-size: 30rpx;
							color: #333333;
						}
						.ricons{
							margin-left: 8rpx;
							width: 18rpx;
							height: 18rpx;
						}
					}
					.gname{
						font-weight: 400;
						font-size: 24rpx;
						color: #BBBBBB;
						display: block;
						margin-top: 14rpx;
					}
				}
			}
		}
	}
	.content{
		// background: #f9f9f9;
		padding-bottom: 30rpx;
		position: relative;
		.img_bj{
			position: absolute;
			width: 100%;
			height: 600rpx;
			top: 0;

		}
		.tone{
			padding: 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-bottom: 30rpx;
			.tleft{
				display: flex;
				flex-direction: column;
				.jl{
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
				}
				.jlnum{
					font-weight: bold;
					font-size: 50rpx;
					color: #FFFFFF;
					display: block;
					margin-top: 10rpx;
				}
			}
			.tixian{
				margin-left: auto;
				padding: 14rpx 20rpx;
				background: rgba(255,255,255,0.2);
				border-radius: 10rpx;
				border: 1px solid #FFFFFF;
				font-weight: bold;
				font-size: 30rpx;
				color: #FFFFFF;
			}
		}
		.ttwo{
			background: #FFFFFF;
			border-radius: 30rpx;
			padding: 30rpx 30rpx;
			display: flex;
			flex-direction: column;
			margin: 0rpx 30rpx 20rpx;
			.biaoti{
				font-weight: bold;
				font-size: 32rpx;
				color: #111111;
				display: block;
				margin-bottom: 20rpx;
				margin-left: 30rpx;
			}
			.tworow{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 15rpx 0;
				.yeitem{
					border-right: 1rpx solid #eee;
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					.yenum{
						font-weight: bold;
						font-size: 34rpx;
						color: #111111;
					}
					.yename{
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						display: block;
						margin-top: 10rpx;
					}
				}
				.yeitem:last-child{
					border-right: none;

				}
				.tname{
					font-weight: bold;
					font-size: 32rpx;
					color: #111111;
				}
				.twright{
					margin-left: auto;
					display: flex;
					flex-direction: row;
					align-items: center;
					.ren{
						font-weight: bold;
						font-size: 32rpx;
						color: #111111;
					}
					.icon_right{
						margin-left: 11rpx;
						width: 24rpx;
						height: 24rpx;
					}
				}
			}
			.threeitem{
				border-top: 1rpx solid #eee;
			}
			.heng{
				height: 10rpx;
				background: #EEEEEE;
				width: 100%;
				margin: 30rpx 0;
			}
			.tiview{
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-bottom: 20rpx;
				.biaoti{
					margin-bottom: 0rpx;
				}
				.quanbu{
					margin-left: auto;
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-right: 30rpx;
					.quan{
						font-weight: 500;
						font-size: 26rpx;
						color: #666666;
					}
					.icon_right{
						margin-left: 10rpx;
						width: 20rpx;
						height: 20rpx;
					}
				}
			}
			.jieview{
				background: #F5F5F5;
				border-radius: 20rpx;
				display: flex;
				flex-direction: column;
				padding: 30rpx;
				margin: 0 30rpx 20rpx;
				.jieone{
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-bottom: 8rpx;
					.jname{
						font-weight: bold;
						font-size: 28rpx;
						color: #111111;
						max-width: 80%;
						display: inline-block;
					}
					.jia{
						margin-left: auto;
						font-weight: bold;
						font-size: 28rpx;
						color: #111111;
					}
					.jtime{
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
					}
				}
				.jieone:last-child{
					margin-bottom: 0;
				}
			}
		}
	}
	.mthree{
			background: #FFFFFF;
			border-radius: 30rpx;
			padding: 30rpx 30rpx 0 30rpx;
			margin: 20rpx 30rpx 20rpx;
			display: flex;
			flex-direction: column;
			flex-wrap: wrap;
			.qita{
				font-weight: bold;
				font-size: 28rpx;
				color: #111111;
				display: block;
				margin-bottom: 30rpx;
			}
			.qitaview{
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				.qitem{
					width: 25%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					justify-content: center;
					margin-bottom: 30rpx;
					position: relative;
					.micon{
						width: 56rpx;
						height: 56rpx;
						margin-bottom: 7rpx;
					}
					text{
						font-weight: 500;
						font-size: 24rpx;
						color: #333333;
					}
				}
				.mvone{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					justify-content: center;
					width: 100%;
				}
			}
			// align-items: center;
			.mtitem{
				display: flex;
				padding: 30rpx 0;
				flex-direction: row;
				align-items: center;
				border-bottom: 1rpx solid #EEEEEE;
				.micon{
					width: 32rpx;
					height: 32rpx;
					margin-right: 10rpx;
				}
				.mitemname{
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
				.ml{
					margin-left: auto;
				}
				.mfan{
					width: 20rpx;
					height: 24rpx;
				}
			}
			.mtitem:last-child{
				border-bottom: none;
			}
		}
		.btn{
				position: absolute;
				background-color: transparent;
				width: 100%;
				height: 100%;
				z-index: 1;
				left: 0;
				padding: 0;
				border: none !important;
			}
			/deep/ button::after  {
			border: none;
			
		}
</style>
